package com.dmzc.stage1.chapter3;

import java.util.concurrent.TimeUnit;

/**
 * 测试可中断方法之前检测
 */
public class ThreadInterrupt3 {
    public static void main(String[] args)  {
        Thread.currentThread().interrupt();
        System.out.println(Thread.currentThread().isInterrupted());
        //如果一个线程设置了中断信号，之后的可中断方法也会立即中断
        try {
            TimeUnit.MINUTES.sleep(1);
        } catch (InterruptedException e) {
            System.out.println("检测到中断信号");
        }
    }
}
